/*
 * 文章分类管理
 */
const express = require("express");
const catesHandle = require("../router_handle/cates");
// 导入数据合法性验证的中间件
const expressJoi = require("@escook/express-joi");
const {
    add_cates_schema,
    id_cates_schema,
    update_cates_schema,
} = require("../schema/cates");
const router = express.Router();

// 获取文章分类
router.get("/cates", catesHandle.getCates);
// 根据id获取文章分类信息
router.get(
    "/getCate/:id",
    expressJoi(id_cates_schema),
    catesHandle.getCateById
);
// 添加文章分类
router.post("/addCates", expressJoi(add_cates_schema), catesHandle.addCates);
// 根据id删除分类
router.get(
    "/deleteCate/:id",
    expressJoi(id_cates_schema),
    catesHandle.deleteCateById
);
// 根据id修改文章分类
router.post(
    "/updateCate",
    expressJoi(update_cates_schema),
    catesHandle.updateCate
);
module.exports = router;